/* MERARY Premium B v3 — «Аркада» (only the compare block; everything else is premium-b2.css unchanged)
 * Niches are cut into a velvet wall. Each row stands on one shared ledge; engraved plaques sit below it.
 * Tokens come from premium-b2.css (see b3-dna.json). */

.v3-gallery {
  position: relative;
  padding: var(--section) var(--gut) calc(var(--section) * .8);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .9 0 0 0 0 .9 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--velvet) 0%, #1c0c14 55%, var(--night) 100%);
}
.v3-gallery__head, .v3-arcade, .v3-empty, .v3-gallery__more { max-width: var(--max); margin-left: auto; margin-right: auto; }
.v3-gallery__head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s3) var(--s5); flex-wrap: wrap; margin-bottom: var(--s7); }
.v3-gallery h2 { font-size: clamp(34px, 4vw, 60px); line-height: 1.02; }
.v3-gallery__intro p { margin: var(--s2) 0 0; max-width: 60ch; color: var(--mist); font-size: 14px; }
.v3-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }

/* ---------- Arcade ---------- */
.v3-row {
  position: relative; display: grid; grid-template-rows: auto auto; align-items: end;
  column-gap: clamp(28px, 4vw, 64px); justify-content: center;
  margin-bottom: clamp(72px, 8vw, 112px);
}
.v3-row:last-child { margin-bottom: 0; }
.v3-bay { grid-row: 1 / span 2; display: grid; grid-template-rows: subgrid; min-width: 0; position: relative; z-index: 1; }

/* the shared ledge: a stone/velvet shelf the niches stand on */
.v3-ledge {
  grid-row: 2; grid-column: 1 / -1; align-self: start; z-index: 0;
  height: 14px; margin: 0 calc(-1 * clamp(16px, 2vw, 32px));
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(244, 233, 227, .34) 0 1px, #43202f 1px, #2a1320 6px, #1a0b12 100%);
  box-shadow: 0 24px 32px -16px rgba(0, 0, 0, .85);
}

.v3-niche {
  grid-row: 1; align-self: end; position: relative; display: block; width: 100%;
  appearance: none; border: 0; padding: 0; background: none; cursor: zoom-in;
  --px: 0; --py: 0;
  transition: filter var(--t2) ease;
}
/* archivolt molding — the arch is architecture, not a rounded photo */
.v3-niche::before {
  content: ''; position: absolute; inset: -11px -11px 0 -11px; pointer-events: none;
  border: 1px solid rgba(244, 233, 227, .24); border-bottom: 0; border-radius: 999px 999px 0 0;
  transition: border-color var(--t2) ease;
}
.v3-bay.is-grand .v3-niche::after {
  content: ''; position: absolute; inset: -22px -22px 0 -22px; pointer-events: none;
  border: 1px solid rgba(244, 233, 227, .11); border-bottom: 0; border-radius: 999px 999px 0 0;
}
/* picture lamp above the niche */
.v3-niche__lamp {
  position: absolute; left: 50%; top: -38px; width: 38px; height: 3px; transform: translateX(-50%);
  border-radius: 2px; background: linear-gradient(90deg, #7d5d48, #ecd3b2, #7d5d48);
  box-shadow: 0 2px 10px rgba(255, 220, 190, .35);
}
.v3-bay.is-grand .v3-niche__lamp { top: -50px; width: 52px; }

.v3-niche__arch {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; overflow: hidden;
  border-radius: 999px 999px 0 0;
  background: radial-gradient(70% 55% at 50% 36%, color-mix(in srgb, var(--glow) 82%, #fff 6%) 0%, #14080d 80%);
  box-shadow: 0 0 120px -40px color-mix(in srgb, var(--glow) 90%, #fff 10%);
}
.v3-bay.is-grand .v3-niche__arch { aspect-ratio: 5 / 6; }
.v3-niche__arch img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%;
  transform: scale(1.08) translate(calc(var(--px) * -14px), calc(var(--py) * -10px));
  transition: transform .9s var(--ease), filter var(--t2) ease;
}
/* demo looks: real objects standing on the ledge inside an empty lit niche */
.v3-bay.is-cut .v3-niche__arch img {
  object-fit: contain; object-position: 50% 100%; padding: 22% 5% 1%;
  transform: translate(calc(var(--px) * -8px), 0);
  filter: drop-shadow(0 18px 16px rgba(0, 0, 0, .6));
}
.v3-bay.is-box .v3-niche__arch img { padding: 22% 0 1%; }
/* light falling from the lamp onto the back wall + recess shadow */
.v3-niche__arch::before, .v3-niche__arch::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit; }
.v3-niche__arch::before { background: radial-gradient(55% 34% at 50% 0%, rgba(255, 232, 214, .38), transparent 75%); mix-blend-mode: screen; opacity: .5; transition: opacity var(--t2) ease; }
.v3-niche__arch::after {
  box-shadow: inset 0 22px 34px -14px rgba(10, 4, 7, .75), inset 16px 0 30px -18px rgba(10, 4, 7, .7), inset -16px 0 30px -18px rgba(10, 4, 7, .7), inset 0 -10px 18px -12px rgba(10, 4, 7, .6);
}

/* ---------- Plaque ---------- */
.v3-plaque { grid-row: 2; position: relative; z-index: 1; padding-top: 34px; text-align: center; max-width: 34ch; margin: 0 auto; }
.v3-plaque__tag { display: inline-block; margin: 0 0 10px; padding: 4px 11px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-2); font-size: 11.5px; color: var(--champ); }
.v3-plaque h3 { font-style: italic; font-size: 22px; line-height: 1.2; }
.v3-bay.is-grand .v3-plaque h3 { font-size: 28px; }
.v3-plaque h3 a { text-decoration: none; transition: color var(--t1) ease; }
.v3-plaque h3 a:hover { color: var(--rose); }
.v3-plaque__comp { margin: 6px 0 0; font-size: 13px; color: var(--mist); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.v3-plaque__buy { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin-top: var(--s2); }
.v3-price { font-family: var(--display); font-size: 21px; line-height: 1; font-variant-numeric: lining-nums; }
.v3-bay.is-grand .v3-price { font-size: 25px; }
.v3-price.v3-price--ask, .v3-bay.is-grand .v3-price.v3-price--ask { font-family: var(--ui); font-size: 13px; color: var(--mist); }

/* ---------- Hover: lamp on, bouquet leans in, neighbours fall into shadow ---------- */
@media (hover: hover) and (pointer: fine) {
  .v3-bay:hover .v3-niche__arch::before, .v3-niche:focus-visible .v3-niche__arch::before { opacity: 1; }
  .v3-bay:hover .v3-niche::before { border-color: rgba(244, 233, 227, .5); }
  .v3-bay:not(.is-cut):hover .v3-niche__arch img { transform: scale(1.13) translate(calc(var(--px) * -14px), calc(var(--py) * -10px)); }
  .v3-arcade:has(.v3-bay:hover) .v3-bay:not(:hover) .v3-niche { filter: brightness(.6) saturate(.85); }
}
.v3-niche:focus-visible { outline: none; }
.v3-niche:focus-visible::before { border-color: var(--rose); border-width: 2px; }

.v3-empty { color: var(--mist); text-align: center; }
.v3-gallery__more { margin-top: var(--s6); text-align: center; }

/* ---------- Close-up view ---------- */
html.v3-locked { overflow: hidden; }
html.v3-locked .mpx-toast { z-index: 80; }
/* add-to-cart feedback from this block: v2 toast shrank to half the screen on phones (fixed + left:50%) */
.mpx-toast { width: max-content; }
@media (max-width: 760px) {
  html.v3-locked .mpx-toast { top: 12px; bottom: auto; transform: translate(-50%, -180%); }
  html.v3-locked .mpx-toast.is-on { transform: translate(-50%, 0); }
}
.v3-view { --glow: #6b2a4c; position: fixed; inset: 0; z-index: 70; }
.v3-view__backdrop {
  position: absolute; inset: 0; opacity: 0; transition: opacity .35s ease;
  background: radial-gradient(50% 60% at 32% 50%, color-mix(in srgb, var(--glow) 70%, transparent), transparent 75%), #120609;
}
.v3-view.is-open .v3-view__backdrop { opacity: 1; }
.v3-view__room {
  position: relative; height: 100%; max-width: 1240px; margin: 0 auto; padding: 72px var(--gut) 48px;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: var(--s6); align-items: center;
  opacity: 0; transition: opacity .3s ease;
}
.v3-view.is-open .v3-view__room { opacity: 1; }
.v3-view__piece { margin: 0; display: grid; place-items: center; }
.v3-view__arch {
  position: relative; display: block; height: min(78vh, 760px); max-width: 100%; aspect-ratio: 4 / 5; overflow: hidden;
  border-radius: 999px 999px 8px 8px;
  outline: 1px solid rgba(244, 233, 227, .28); outline-offset: 14px;
  box-shadow: 0 60px 90px -40px rgba(0, 0, 0, .85), 0 0 160px -30px color-mix(in srgb, var(--glow) 90%, #fff 10%);
  background: radial-gradient(70% 55% at 50% 36%, color-mix(in srgb, var(--glow) 82%, #fff 6%) 0%, #14080d 80%);
}
.v3-view__arch img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.v3-view__arch.is-cut img { object-fit: contain; object-position: 50% 100%; padding: 16% 4% 3%; filter: drop-shadow(0 24px 20px rgba(0, 0, 0, .6)); }
.v3-view__count { margin: 0 0 var(--s2); font-size: 13px; color: var(--mist); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.v3-view__name { font-style: italic; font-size: clamp(36px, 4vw, 60px); line-height: 1.04; text-wrap: balance; }
.v3-view__comp { margin: var(--s3) 0 6px; font-size: 16px; color: rgba(244, 233, 227, .9); max-width: 34ch; }
.v3-view__meta { margin: 0; font-size: 13px; color: var(--mist); max-width: 36ch; }
.v3-view__price { margin: var(--s4) 0 var(--s3); font-family: var(--display); font-size: clamp(28px, 2.6vw, 38px); line-height: 1; }
.v3-view__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
.v3-view__nav { display: flex; gap: 12px; margin-top: var(--s5); }
.v3-view__room.is-swap .v3-view__info > *, .v3-view__room.is-swap .v3-view__piece { animation: v2-fade var(--t2) var(--ease) both; }
.v3-view__close {
  position: absolute; top: 20px; right: var(--gut); width: 48px; height: 48px; border-radius: 50%; cursor: pointer;
  background: rgba(244, 233, 227, .06); border: 1px solid var(--line-2);
}
.v3-view__close::before, .v3-view__close::after { content: ''; position: absolute; left: 50%; top: 50%; width: 18px; height: 1.5px; background: var(--champ); transform: translate(-50%, -50%) rotate(45deg); }
.v3-view__close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.v3-view__close:hover { background: rgba(244, 233, 227, .15); }

@media (prefers-reduced-motion: reduce) {
  .v3-niche__arch img { transform: none !important; }
}

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .v3-row { column-gap: 36px; }
  .v3-plaque h3 { font-size: 20px; }
  .v3-bay.is-grand .v3-plaque h3 { font-size: 24px; }
  .v3-view__room { grid-template-columns: 1fr 1fr; gap: var(--s4); }
}

/* ---------- Phone: one grand niche, then a pair ---------- */
@media (max-width: 760px) {
  .v3-gallery__head { flex-direction: column; align-items: stretch; margin-bottom: var(--s6); }
  .v3-controls { gap: 8px; }
  .v3-controls .v2-seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .v3-row { column-gap: 18px; margin-bottom: var(--s6); }
  .v3-row--1 { padding: 0 6%; }
  .v3-row--1:has(.is-grand) { grid-template-columns: minmax(0, 1fr) !important; }
  .v3-ledge { height: 11px; margin: 0 -8px; }
  .v3-niche::before { inset: -7px -7px 0 -7px; }
  .v3-bay.is-grand .v3-niche::after { inset: -14px -14px 0 -14px; }
  .v3-niche__lamp { top: -24px; width: 26px; }
  .v3-bay.is-grand .v3-niche__lamp { top: -34px; width: 38px; }
  .v3-plaque { padding-top: 24px; }
  .v3-plaque h3 { font-size: 17px; }
  .v3-bay.is-grand .v3-plaque h3 { font-size: 24px; }
  .v3-plaque__comp { font-size: 12px; }
  .v3-price { font-size: 18px; }
  .v3-bay.is-grand .v3-price { font-size: 22px; }
  .v3-row--2 .v3-plaque__buy { flex-direction: column; gap: 10px; }
  .v3-row--2 .v3-plaque__buy .v2-btn { width: 100%; padding: 0 10px; }
  .v3-bay.is-cut .v3-niche__arch img { padding: 18% 3% 1%; }

  .v3-view__room { grid-template-columns: 1fr; align-content: start; gap: var(--s3); overflow-y: auto; padding: 72px var(--gut) 32px; }
  .v3-view__arch { height: auto; width: min(100%, 52vh * .8); }
  .v3-view__name { font-size: 34px; }
  .v3-view__comp { margin-top: var(--s2); font-size: 15px; }
  .v3-view__actions .v2-btn { flex: 1 1 100%; }
  .v3-view__nav { margin-top: var(--s3); justify-content: center; }
  .v3-view__close { top: 12px; width: 44px; height: 44px; }
}
